//
//  CRCellBottomView.m
//  CRChatRoom
//
//  Created by lanou3g on 15/11/23.
//  Copyright © 2015年 SecondGroup. All rights reserved.
//

#import "CRCellBottomView.h"
#define textFont [UIFont systemFontOfSize:12]

@interface CRCellBottomView ()



@end

@implementation CRCellBottomView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.userInteractionEnabled = YES;
        
        self.praise = [[UILabel alloc] init];
        self.praise.font = textFont;
        self.praise.textColor = [UIColor lightGrayColor];
        
        
        self.noPraise = [[UILabel alloc] init];
        self.noPraise.font = textFont;
        self.noPraise.textColor = [UIColor lightGrayColor];

        
        self.share = [[UILabel alloc] init];
        self.share.font = textFont;
        self.share.textColor = [UIColor lightGrayColor];
        
        self.address = [[UILabel alloc] init];
        self.address.font = [UIFont systemFontOfSize:11];
        self.addressIcon = [[UIImageView alloc] init];
        
        
        self.praiseButton = [[UIButton alloc] init];
//        self.praiseButton.tag = praiseButton;
        self.noPraiseButton = [[UIButton alloc] init];
//        self.noPraiseButton.tag = noPraiseButton;
        self.shareButton = [[UIButton alloc] init];
//        self.shareButton.tag = shareButton;
        
//        [self.praiseButton addTarget:self action:@selector(clickButtontype:) forControlEvents:UIControlEventTouchUpInside];
//        [self.noPraiseButton addTarget:self action:@selector(clickButtontype:) forControlEvents:UIControlEventTouchUpInside];
//        [self.shareButton addTarget:self action:@selector(clickButtontype:) forControlEvents:UIControlEventTouchUpInside];
        
        [self addSubview:self.praise];
        [self addSubview:self.noPraise];
        [self addSubview:self.share];
        [self addSubview:self.praiseButton];
        [self addSubview:self.noPraiseButton];
        [self addSubview:self.shareButton];
        [self addSubview:self.address];
        [self addSubview:self.addressIcon];
    
        
        
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
//    self.praise.frame = CGRectMake(220, 0, 20, 10);
//    self.noPraise.frame = CGRectMake(280, 0, 20, 10);
//    self.share.frame = CGRectMake(340, 0, 20, 10);
//    
//    self.address.frame = CGRectMake(20, 17, 230, 17);
//    self.addressIcon.frame = CGRectMake(5, 18, 15, 15);
//    
//    self.praiseButton.frame = CGRectMake(220, 17, 17, 17);
//    self.noPraiseButton.frame = CGRectMake(280, 17, 17, 17);
//    self.shareButton.frame = CGRectMake(340, 17, 17, 17);
    
    
    self.share.frame = CGRectMake(self.width - 30, 0, 20, 10);
    self.noPraise.frame = CGRectMake(self.width - 70, 0, 20, 10);
    self.praise.frame = CGRectMake(self.width - 110, 0, 20, 10);
    
    
    self.praiseButton.frame = CGRectMake(self.width - 110, 17, 17, 17);
    self.noPraiseButton.frame = CGRectMake(self.width - 70, 17, 17, 17);
    self.shareButton.frame = CGRectMake(self.width - 30, 17, 17, 17);

    
    self.addressIcon.frame = CGRectMake(5, 18, 15, 15);
    self.address.frame = CGRectMake(20, 17, self.width - 20 - 110, 17);
    

    [self.praiseButton setBackgroundImage:[UIImage imageNamed:@"iconfont-iconfontzanzan"] forState:UIControlStateNormal];
    
    [self.praiseButton setBackgroundImage:[UIImage imageNamed:@"iconfont-zan(1)"] forState:UIControlStateHighlighted];
    
    [self.noPraiseButton setBackgroundImage:[UIImage imageNamed:@"iconfont-iconfontzan"] forState:UIControlStateNormal];
    [self.noPraiseButton setBackgroundImage:[UIImage imageNamed:@"iconfont-iconfontzan(1)"] forState:UIControlStateHighlighted];
    
    [self.shareButton setBackgroundImage:[UIImage imageNamed:@"iconfont-fenxiang"] forState:UIControlStateNormal];
    [self.shareButton setBackgroundImage:[UIImage imageNamed:@"iconfont-fenxiang(1)"] forState:UIControlStateHighlighted];
    
}


//// 没走
//- (void)clickButtontype:(UIButton *)button
//{
//    NSLog(@"button");
//    if ([self.delegate respondsToSelector:@selector(cellBottomViewButtonClick:andpraiseLabel:andNoPraiseLabel:andShareLabel:)]) {
//        [self.delegate cellBottomViewButtonClick:button andpraiseLabel:self.praise andNoPraiseLabel:self.noPraise andShareLabel:self.share];
//    }
//}


@end













